<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单</title>


    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.6.5/css/layui.css">
</head>
<body style="padding: 20px;">
<div class="layui-row">
    <div class="layui-col-md2">
        <div id="test1"></div>
    </div>
    <div class="layui-col-md2" style="padding-left: 20px;">
        <script type="text/html" template id="list-record-temp">
            @{{# layui.each(d.data,function(index,item){ }}

            @{{# if(item.status == 'running'){ }}
            <a href="javascript:" data-id="@{{ item.id }}"> @{{ item.member__name }} @{{ item.time_start }}</a>(待处理)
            @{{# }else if(item.status == 'complete'){ }}
            <a href="javascript:" data-id="@{{ item.id }}"> @{{ item.member__name }} @{{ item.time_start }}</a>(已通过)


            @{{# } }}
            <hr class="layui-bg-gray">
            @{{# }) }}
        </script>
        <div id="list-record">
        </div>
        <div id="list-page"></div>
    </div>
    <script type="text/html" id="list-table-temp">
        <style type="text/css">
            table {
                border-collapse:collapse;
                border:solid 1px Black;
                margin: 0 auto;
                font-family: 宋体, Arial, Helvetica, sans-serif;
                font-size: 14px;
                text-align: center;
            }
            table td{
                border:1px solid black;
            }

        </style>
        <div style="text-align: center;">
            <p style="font-size: 22px; font-weight: bolder; height: 30px;">浙江省机电技师学院@{{ d.title }}</p>
            <p style="font-size: 18px; font-weight: bolder; height: 25px;">(@{{d.form_data[6].value}})</p>
            <table>
                <tbody><tr>
                    <td colspan="2" style="height: 10mm">@{{ d.form_data[0].label }}</td>
                    <td>
                        <span id="Label1">@{{ d.form_data[0].value }}</span>
                    </td>
                    <td colspan="2">@{{ d.form_data[1].label }}</td>
                    <td colspan="3">
                        <span id="Label2">@{{ d.form_data[1].value }}</span>
                    </td>
                </tr>
                <tr>
                    <td rowspan="2">@{{ d.form_data[2].label }}</td>
                    <td colspan="7" style="height: 50mm; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; vertical-align: top; text-align: left;">&nbsp;<br>
                        <br>
                        <span id="Label3">  @{{ d.form_data[2].value }}</span>
                        &nbsp; </td>
                </tr>
                <tr>
                    <td style="height: 9mm">@{{ d.form_data[3].label }}</td>
                    <td>
                        <span id="Label4">@{{ d.form_data[3].value }}</span>
                    </td>
                    <td colspan="2">@{{ d.form_data[4].label }}</td>
                    <td>
                        <span id="Label5">@{{ d.form_data[4].value }}</span>
                    </td>
                    <td>@{{ d.form_data[5].label }}</td>
                    <td style="width: 20mm">
                        <span id="Label6">@{{ d.form_data[5].value }}</span>
                    </td>
                </tr>
                <tr>
                    <td style="height: 1cm; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;">序号</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">物品名称</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">规格型号</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">单位</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">数量</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">单价</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">小计</td>
                    <td style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; height: 1cm;">备注</td>
                </tr>
                @{{# let num = 0; }}
                @{{# layui.each(d.form_data[7].value,function(index,item){ }}
                @{{# num = num + item[5].value * 1; }}
                <tr>
                    <td style="width: 10mm; height: 9mm;">@{{ index + 1 }}</td>
                    <td style="width: 40mm">@{{ item[0].value }}</td>
                    <td style="width: 35mm">@{{ item[1].value }}</td>
                    <td style="width: 15mm">@{{ item[2].value }}</td>
                    <td style="width: 15mm">@{{ item[3].value }}</td>
                    <td style="width: 20mm">@{{ item[4].value }}</td>
                    <td style="width: 25mm">@{{ item[5].value }}</td>
                    <td style="width: 20mm" colspan="0">&nbsp;</td>
                </tr>
                @{{# }) }}
                <tr>
                    <td style="width: 10mm; height: 9mm;">&nbsp;</td>
                    <td style="width: 40mm">合计</td>
                    <td style="width: 35mm">&nbsp;</td>
                    <td style="width: 15mm">&nbsp;</td>
                    <td style="width: 15mm">&nbsp;</td>
                    <td style="width: 20mm">&nbsp;</td>
                    <td style="width: 25mm">@{{ num }}</td>
                    <td style="width: 20mm">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 15mm">处（系）负责人</td>
                    <td colspan="6">
                        @{{# layui.each(d.node_user[0].data,function(index,item){ }}
                        @{{ item.status_name || '' }}，@{{ item.name }}，@{{ item.time }} <br>

                        @{{# }) }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 15mm">分管领导意见</td>
                    <td colspan="6">
                        @{{# layui.each(d.node_user[1].data,function(index,item){ }}
                        @{{ item.status_name || '' }}，@{{ item.name }}，@{{ item.time }} <br>

                        @{{# }) }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 15mm">财务处审核意见</td>
                    <td colspan="6">
                        @{{# layui.each(d.node_user[2].data,function(index,item){ }}
                        @{{ item.status_name || '' }}，@{{ item.name }}，@{{ item.time }} <br>

                        @{{# }) }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 15mm">财务分管领导意见</td>
                    <td colspan="6">
                        @{{# layui.each(d.node_user[3].data,function(index,item){ }}
                        @{{ item.status_name || '' }}，@{{ item.name }}，@{{ item.time }} <br>

                        @{{# }) }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 15mm">院长审批意见</td>
                    <td colspan="6">
                        @{{# if(d.node_user[4]){ }}
                        @{{# layui.each(d.node_user[4].data,function(index,item){ }}
                        @{{ item.status_name }}，@{{ item.name }}，@{{ item.time }} <br>

                        @{{# }) }}
                        @{{# } }}
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 10mm">执行情况</td>
                    <td colspan="6">&nbsp;</td>
                </tr>
                </tbody>
            </table>
        </div>
    </script>
    <div class="layui-col-md8" style="padding-left: 20px">
        <button class="layui-btn layui-btn-sm" id="list-print">
            <i class="layui-icon layui-icon-print"></i>
            打印
        </button>
    </div>
    <div class="layui-col-md8" style="padding-left: 20px;" id="list-table">

    </div>

</div>
</body>
<!-- 引入 layui.js -->
<script src="https://www.layuicdn.com/layui-v2.6.5/layui.js"></script>

<script>
    layui.use(['tree','laytpl','layer','laypage'], function(){
        let $   = layui.$
            ,tree = layui.tree
            ,laytpl = layui.laytpl
            ,laypage = layui.laypage

        $.getJSON('/record',function (result) {

            laytpl($('#list-record-temp').html()).render(result,function (html) {

                $('#list-record').html(html);
            })

            laypage.render({
                elem: 'list-page'
                ,count: result.meta.count
                ,jump: function(o, first){

                    //首次不执行
                    if(!first){

                        $.getJSON('/record',{id:obj.data.id,page:o.curr},function (re) {

                            laytpl($('#list-record-temp').html()).render(re, function (html) {

                                $('#list-record').html(html);
                            })
                        })
                    }
                }
            });

            $('#list-record a').on('click',function () {

                let id = $(this).data('id');
                $.getJSON('/detail',{id:id},function (r) {


                    laytpl($('#list-table-temp').html()).render(r.data,function (html) {
                        $('#list-table').html(html);
                    })
                })
            });
            $('#list-record a:first').click();

            $('#list-print').on('click',function () {

                var newWindow=window.open("打印窗口","_blank");
                var docStr = window.document.getElementById('list-table').innerHTML;
                newWindow.document.write(docStr);
                newWindow.document.close();
                newWindow.print();
                newWindow.close();
            })
        })
    });
</script>
</html>
